# -*- coding: utf-8 -*-
"""
Spyder Editor

This is a temporary script file.
"""
import numpy as np
from scipy import signal
from skimage import data
from matplotlib import pyplot as plt
def corre12d(img,window):
    s=signal.correlate2d(img,window,mode='same',boundary='fill')
    return s.astype(np.uint8)
img=data.camera()
window1=np.ones((3,3))/(3**3)
window2=np.ones((5,5))/(5**2)
window3=np.ones((9,9))/(9**2)
new_img1=corre12d(img,window1)
new_img2=corre12d(img,window2)
new_img3=corre12d(img,window3)
plt.figure()
plt.imshow(img,cmap='gray')
plt.figure()
plt.imshow(new_img1,cmap='gray')
plt.figure()
plt.imshow(new_img2,cmap='gray')
plt.figure()
plt.imshow(new_img3,cmap='gray')
